// ============================== 导入依赖 ============================== //

const dist = process.env.VUE_APP_DIST
const base = process.env.VUE_APP_RUN
const isProd = process.env.VUE_APP_IS_PROD
const project = process.env.VUE_APP_PROJECT

const PROXY = {
  target: 'http://ibdev.hzzxinfo.com',
  headers: { Connection: 'keep-alive' },
}

// ============================== 导出配置 ============================== //

module.exports = {
  publicPath: base || '/',
  outputDir: isProd && project ? `D:\\桌面\\${project}\\${dist || base}` : `dist${base}`,

  lintOnSave: true,
  productionSourceMap: false,

  devServer: {
    host: process.env.VUE_APP_DEBUG_HOST || '0.0.0.0',
    port: process.env.VUE_APP_DEBUG_PORT || 8080,
    proxy: {
      '/cdn/': PROXY,
      '/common/': PROXY,
      '/storage/': PROXY,
      '/asset/': PROXY,
      '/iot/platform/': {
        ...PROXY,
        target: `${PROXY.target}:18811`,
      },
      '': {
        ...PROXY,
        target: process.env.VUE_APP_DEBUG_PROXY || PROXY.target,
      },
    },
  },
}
